
<script setup lang="ts">
import { useAdmin } from '../../../stores/admin' //导入 admin 状态文件
import { ref } from 'vue' //执行方法获得 adminStore 对象
const adminStore = useAdmin()
//用户头像
const headImage = ref("")
if(adminStore.admin.avatar == ""){
headImage.value = "/images/avatar-default.jpg"
}else{
headImage.value = adminStore.admin.avatar
} </script>

<template>
  <section class="login_state">
    <div>
      <div><img :src="headImage" /></div>
      <div>{{ adminStore.admin.username }}</div>
    </div>
    <div>{{ adminStore.admin.loginTime }}</div>
    <div>{{ adminStore.admin.loginPlace }}</div>
  </section>
</template>
<style scoped>
.login_state {
  border: 1px solid #e4e7ed;
  border-radius: 5px;
  width: 25%;
  box-shadow: 0px 0px 5px 5px #e4e7ed;
  margin: 20px;
}
.login_state > div:first-child {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e4e7ed;
}
.login_state > div:first-child > div {
  margin: 10px 20px;
  font-size: 20px;
}
.login_state > div:not(:first-child) {
  line-height: 30px;
  margin: 10px 20px;
}
.login_state img {
  width: 50px;
  height: 50px;
}
</style>
